package com.itany.shop.util;

import java.util.Date;
import java.util.Random;

/**
 * @Author:石小俊
 * @Date:2022/11/15 14:02
 * @Version:1.0-SNAPSHOT
 * @Description:
 */
public class ParameterUtil {

    public static boolean isNull(String param){
        return null == param || "".equals(param);
    }

    /**
     * 生成订单号
     * 要求:前四位为英文字母或者数字,后面使用当前毫秒数防止重复
     * @return
     */
    public static String getNo(){
        String s = "0123456789qwertyuioplkjhgfdsazxcvbnm";
        StringBuffer buffer = new StringBuffer();
        for(int i = 0; i < 4; i++){
            buffer.append(s.charAt(new Random().nextInt(s.length())));
        }
        return buffer.toString()+new Date().getTime();
    }

}
